/**
 * 作者:hanbo
 * 日期:2018/11/1915:43
 * 描述: 地图事件注册中心
 */
export class EventCenter {
    constructor(mapView) {
        this._mapView = mapView;
    }


    /**
     * 地图点击时触发
     */
    onClick() {

    }

    /**
     * 视图变化后触发
     */
    onViewChanged() {
        let render = this._mapView._mapRender;
        let extend = this._mapView.gLStateCenter.getMapExtend();
        let level = this._mapView.gLStateCenter.getMapLevel();
        this._mapView._layerManager.onViewChanged(render, extend,level);
    }

    /**
     * 当实时移动触发
     */
    onMove(){
        this._mapView.mapControl.updateCoordText();
    }

    onSizeChange() {

    }

    onMoveEnd() {
        this.onViewChanged();
    }

    onZoom() {

    }

    onZoomEnd() {
        this.onViewChanged();
        //计算比例尺
        let denominator=this._mapView.gLStateCenter.getScaleDenominator();
        this._mapView.mapControl.updateScaleControl(denominator);
    }

    /**
     * 地图准备完成触发
     */
    onMapReady() {
        
        this.onViewChanged();
        //计算比例尺
        let denominator=this._mapView.gLStateCenter.getScaleDenominator();
        this._mapView.mapControl.updateScaleControl(denominator);
    }
}